package com.ruoyi.customer.api.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;

/**
 * 推送给设备的用户信息对象 zkxc_user
 *
 * @author ruoyi
 * @date 2025-09-05
 */
public class ZkxcUser extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private Long id;

    /**
     * 用户ID
     */
    private Long customerId;

    /**
     * 用户姓名
     */
    private String name;

    /**
     * 性别 0：女  1：男
     */
    private Integer sex;

    /**
     * 年龄
     */
    private Integer age;

    /**
     * 手机号
     */
    private String phone;

    /**
     * 省份证号码
     */
    private String idCard;

    /**
     * 关联的报告id -- zkxc_push_data
     */
    private Long reportId;

    private BigDecimal height;

    private BigDecimal weight;

    /**
     * 设备编码
     */
    private String mac;

    /**
     * 检查状态 0：已登记 （已录入的用户）1：已完成（完成采集的用户）
     */
    private Integer status;

    /**
     * 渠道号：1.	Android  2.ios
     */
    private Integer channel;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public void setSexStr(String sex) {
        if ("0".equals(sex)) {
            this.sex = 1;
        } else {
            this.sex = 0;
        }
    }

    public Integer getSex() {
        return sex;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
    public void setAgeData(Date birthDate) {
        if (birthDate == null) {
            return;
        }
        Calendar birth = Calendar.getInstance();
        birth.setTime(birthDate);
        Calendar today = Calendar.getInstance();
        int age = today.get(Calendar.YEAR) - birth.get(Calendar.YEAR);
        if (today.get(Calendar.DAY_OF_YEAR) < birth.get(Calendar.DAY_OF_YEAR)) {
            age--;
        }
        this.age = age;
    }

    public Integer getAge() {
        return age;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPhone() {
        return phone;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setReportId(Long reportId) {
        this.reportId = reportId;
    }

    public Long getReportId() {
        return reportId;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public String getMac() {
        return mac;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }

    public void setChannel(Integer channel) {
        this.channel = channel;
    }

    public Integer getChannel() {
        return channel;
    }

    public void setHeight(BigDecimal height) {
        this.height = height;
    }

    public BigDecimal getHeight() {
        return height;
    }

    public BigDecimal getWeight() {
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("customerId", getCustomerId())
                .append("name", getName())
                .append("sex", getSex())
                .append("age", getAge())
                .append("phone", getPhone())
                .append("idCard", getIdCard())
                .append("reportId", getReportId())
                .append("mac", getMac())
                .append("status", getStatus())
                .append("channel", getChannel())
                .append("height", getHeight())
                .append("weight", getWeight())
                .toString();
    }
}
